package com.elise;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;

public class TodaySectionFragment extends Fragment {

	private TextView date;
	private TextView mins;
	private TextView amount;
	
	private ListView list;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		
		View view = inflater.inflate(R.layout.fragment_today, container, false);
		
		date = (TextView) view.findViewById(R.id.fragment_today_date);
		mins = (TextView) view.findViewById(R.id.fragment_today_mins);
		amount = (TextView) view.findViewById(R.id.fragment_today_amount);
		
		list = (ListView) view.findViewById(R.id.fragment_today_list);
		
		Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/clock_font.ttf");
		date.setTypeface(tf);
		mins.setTypeface(tf);
		amount.setTypeface(tf);
		
		SimpleDateFormat df = (SimpleDateFormat) SimpleDateFormat.getDateInstance();
		date.setText(df.format(new Date()));
		
		ArrayList<Etime> items = new ArrayList<Etime>();
		for (int i=0; i < 50; i++) {
			Etime e = new Etime();
			e.setName("A"+i);
			e.setTime_in(new Date());
			e.setMinutes(new Date());
			e.setAmount(i*.17d);
			items.add(e);
		}
		
		list.setAdapter(new EtimeListAdapter(getActivity(), items));
		
		return view;
	}
}
